<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商品ID:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-product-id" class="form-control" name="row[product_id]" type="text" data-rule="required" value="{$row.product_id|htmlentities}" readonly>
        </div>
    </div>
    
    <!-- 商品信息显示区域 -->
    {if condition="isset($product)"}
    <div id="product-info" class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商品信息:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="alert alert-info">
                <strong>{$product.name}</strong>
                <br><small>商品ID: {$product.id} | 分类: {$product.category_name|default='未分类'} | 审核状态: 已通过</small>
            </div>
        </div>
    </div>
    {/if}
    
    <!-- 商品规格列表 -->
    {if condition="isset($skus) && !empty($skus)"}
    <div id="sku-list" class="form-group">
        <label class="control-label col-xs-12 col-sm-2">规格设置:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h4 class="panel-title">为每个规格设置所需积分</h4>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>规格名称</th>
                                    <th>原价</th>
                                    <th>库存</th>
                                    <th>所需积分</th>
                                    <th>状态</th>
                                </tr>
                            </thead>
                            <tbody id="sku-tbody">
                                {volist name="skus" id="sku"}
                                <tr>
                                    <td>{$sku.sku_name}</td>
                                    <td>¥{$sku.price}</td>
                                    <td>{$sku.stock}</td>

                                    <td>
                                        <input type="number" class="form-control" 
                                               name="sku_points[{$sku.id}]" 
                                               value="{$sku.points}" 
                                               placeholder="请输入所需积分" 
                                               style="width: 120px;">
                                    </td>
                                    <td>
                                        <span class="label {if condition='$sku.has_points'}label-success{else /}label-default{/if}">
                                            {if condition="$sku.has_points"}已配置{else /}未配置{/if}
                                        </span>
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {else /}


    <div id="single-points" class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__("所需积分")}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-points" class="form-control" name="row[points]" type="number" value="{$row.points|default=''}" placeholder="请输入所需积分">
        </div>
    </div>
    {/if}

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">上下架状态:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-shelf_status" class="form-control" name="row[shelf_status]">
                <option value="1" {if condition="$row.status == 1"}selected{/if}>上架</option>
                <option value="0" {if condition="$row.status == 0"}selected{/if}>下架</option>
            </select>
        </div>
    </div>
    
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>